﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ex2.Pool
{
    class Resource : IDisposable
    {
        private object name;
        private bool available;

        public Resource(object name)
        {
            this.name = name;
            available = true;
        }
        public bool Available
        {
            get
            {
                return available;
            }
            set
            {
                available = value;
            }
        }
        
        ~Resource()
        {
            Dispose(false);
        }
        
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        
        private void Dispose(bool disposing)
        {
            if (disposing)
            {
                Console.WriteLine("Dispose {0}", name);
            }
            available = true;
        }
    }
}
